from mediator import mediator
from mediator . tests . test_assistant import make_mediator_test_keyword_args

class gui_fake :
    def __init__ ( self ) :
        self . _received_quit_application_args = None
        self . _received_run_main_application_loop_args = None
        self . _received_set_application_window_icon_args = None
        self . _received_set_application_window_title_args = None
        self . _gui_create_application_window_request = False
    def gui_create_application_window_request ( self ) :
        self . _gui_create_application_window_request = True
    def gui_set_application_window_icon ( self , window , icon ) :
        self . _received_set_application_window_icon_args = [ window , icon ]
    def gui_set_application_window_title ( self , window , title ) :
        self . _received_set_application_window_title_args = [ window , title ]
    def gui_run_main_application_loop ( self , window ) :
        self . _received_run_main_application_loop_args = [ window ]
    def gui_quit_application ( self , window ) :
        self . _received_quit_application_args = [ window ]

class mediator_gui_application_tests : 
    'mediator_gui_application'
    def __init__ ( self , test ) :
        self . _test = test
        self . _gui = gui_fake ( )
        self . _mediator = mediator ( )
        self . _mediator . register_modules ( ** make_mediator_test_keyword_args \
            ( 'gui' 
            , self . _gui 
            , None
            ) )
    def test_gui_create_application_window_request ( self ) :
        self . _mediator . gui_create_application_window_request ( )
        self . _test . assume_true ( self . _gui . _gui_create_application_window_request )
    def test_gui_set_application_window_icon ( self ) :
        self . _mediator . gui_set_application_window_icon ( 'my window' , 'my icon' )
        self . _test . assume_equal ( self . _gui . _received_set_application_window_icon_args ,
            [ 'my window'
            , 'my icon'
            ] )
    def test_gui_set_application_window_title ( self ) :
        self . _mediator . gui_set_application_window_title ( 'my window' , 'my title' )
        self . _test . assume_equal ( self . _gui . _received_set_application_window_title_args ,
            [ 'my window'
            , 'my title'
            ] )
    def test_gui_run_main_application_loop ( self ) :
        self . _mediator . gui_run_main_application_loop ( 'my window' )
        self . _test . assume_equal ( self . _gui . _received_run_main_application_loop_args ,
            [ 'my window'
            ] )
    def test_gui_quit_application ( self ) :
        self . _mediator . gui_quit_application ( 'my window' )
        self . _test . assume_equal ( self . _gui . _received_quit_application_args ,
            [ 'my window'
            ] )
